<template>
  <div :class="{left:true,leftWidth:!isclose}">
    <el-menu
      default-active="1"
      class="el-menu-vertical-demo"
      @open="handleOpen"
      @close="handleClose"
      background-color="#2c3e50"
      text-color="#fff"
      active-text-color="#ffd04b"
      :collapse='isclose'
      @select="send"
    >
      <el-menu-item index="1">
        <i class="el-icon-menu"></i>
        <span slot="title" >用户管理</span>
      </el-menu-item>
      <el-menu-item index="2">
        <i class="el-icon-setting"></i>
        <span slot="title">研讨组管理</span>
      </el-menu-item>
      <el-menu-item index="3">
        <i class="el-icon-setting"></i>
        <span slot="title">算法库管理</span>
      </el-menu-item>
      <el-menu-item index="4">
        <i class="el-icon-setting"></i>
        <span slot="title">算法研讨</span>
      </el-menu-item>
      <el-menu-item index="5">
        <i class="el-icon-setting"></i>
        <span slot="title">可视化视图</span>
      </el-menu-item>
      <el-menu-item index="6">
        <i class="el-icon-setting"></i>
        <span slot="title">日志管理</span>
      </el-menu-item>
    </el-menu>
  </div>
</template>
<script>
export default {
    data(){
        return{
          isclose:false
        }
    },
    mounted(){
      this.$root.$on('isclose',(val)=>{
        console.log(val)
        this.isclose=val
      })
    },
    methods: {
      send(val){
        this.$router.push('/homeView/'+val)
        console.log(val)
      },
      handleOpen(key, keyPath) {
        console.log(key, keyPath);
      },
      handleClose(key, keyPath) {
        console.log(key, keyPath);
      }
    }
};
</script>
<style lang="scss" scoped>
.left {
  //  width: 10%;
  height: 100%;
  overflow: hidden;
  background-color: #2c3e50;
  
}
.el-menu-vertical-demo{
    width: 48px;
  }
.leftWidth{
    width: 10%;
    .el-menu-vertical-demo{
      width: 100%;
    }
  }
  
</style>